﻿@model IEnumerable<VedranKrizicPortfolio.Models.Article>
@using VedranKrizicPortfolio.Helpers
@{
    VedranKrizicPortfolio.Models.Article latestNews = ViewBag.LatestNews;
}
<article class="LatestNews">
    @if (latestNews != null)
    {
        <h2 style="display: none;">
            Top Section</h2>
        if (latestNews.CoverIMG != null)
        {
        <div id="portfolioListItemImage">
            <img src="@Url.Content(latestNews.CoverIMG)" alt="@latestNews.Title"/>
        </div>
        }
        <div class="portfolioListItem">
            <div class="portfoluoListItemHeader">
                <h3>@latestNews.Title</h3>
            </div>
            <div class="portfolioListItemBody">
                @Html.Raw(Html.ReduceArticle(@latestNews.Text, 450))
            </div>
            <div class="portfolioListItemButtons">
                <a href="@Url.Action("Details", "Portfolio", new { id = latestNews.wfTitle })">
                    <img src="@Url.Content("~/Content/themes/base/images/Read-MoreButton.png")" alt="Read More"/></a><a href="@Url.Action("Index", "Portfolio")"><img src="@Url.Content("~/Content/themes/base/images/PortfolioButton.png")" alt="Portfolio"/></a>
            </div>
        </div>
    
    }
    else
    {
        <span style="width: 100%; font-size: 16px; text-align: center">Recovering data...</span>
    }
</article>
<section class="BottomSector">
    <h2 style="display: none;">
        Bottom Section</h2>
    <article class="AboutParagraph">
        <h3>
            Welcome</h3>
        <p>
            My Portfolio provides a personal learning environment to record and showcase evidence
            of achievement, manage development plans, set goals, and of course to get me a good
            job too! :)
        </p>
    </article>
    <div class="ProjectImages">
        @if (Model.Count() != 0)
        {
            foreach (VedranKrizicPortfolio.Models.Article rItem in Model)
            {
            <div class="recentItem">
                <a title="@rItem.Title" href="@Url.Action("Details", "Portfolio", new { id = rItem.wfTitle })">
                    
                    @if(rItem.CoverIMG != null){<img src="@Url.Content(rItem.CoverIMG)" alt="@rItem.Title"/>}
                    
                </a>
            </div>
            }
        }
        else
        {
            <span style="width: 100%; font-size: 16px; text-align: center">Recovering data...</span>
        }
    </div>
</section>
